Skip to content

Commit

Permalink
Auto merge of #66887 - dtolnay:rollup-uxowp8d, r=Centril
Browse files Browse the repository at this point in the history
Rollup of 4 pull requests

Successful merges:

 - #66818 (Format libstd/os with rustfmt)
 - #66819 (Format libstd/sys with rustfmt)
 - #66820 (Format libstd with rustfmt)
 - #66847 (Allow any identifier as format arg name)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Nov 30, 2019
2 parents 8f1bbd6 + b14d9c2 commit d8bdb3f
Show file tree
Hide file tree
Showing 242 changed files with 6,132 additions and 5,416 deletions.
33 changes: 17 additions & 16 deletions src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,20 +442,9 @@ impl<'a> Parser<'a> {
Some(ArgumentIs(i))
} else {
match self.cur.peek() {
Some(&(_, c)) if c.is_alphabetic() => {
Some(&(_, c)) if rustc_lexer::is_id_start(c) => {
Some(ArgumentNamed(Symbol::intern(self.word())))
}
Some(&(pos, c)) if c == '_' => {
let invalid_name = self.string(pos);
self.err_with_note(format!("invalid argument name `{}`", invalid_name),
"invalid argument name",
"argument names cannot start with an underscore",
self.to_span_index(pos).to(
self.to_span_index(pos + invalid_name.len())
),
);
Some(ArgumentNamed(Symbol::intern(invalid_name)))
},

// This is an `ArgumentNext`.
// Record the fact and do the resolution after parsing the
Expand Down Expand Up @@ -611,22 +600,34 @@ impl<'a> Parser<'a> {
/// Rust identifier, except that it can't start with `_` character.
fn word(&mut self) -> &'a str {
let start = match self.cur.peek() {
Some(&(pos, c)) if c != '_' && rustc_lexer::is_id_start(c) => {
Some(&(pos, c)) if rustc_lexer::is_id_start(c) => {
self.cur.next();
pos
}
_ => {
return &self.input[..0];
return "";
}
};
let mut end = None;
while let Some(&(pos, c)) = self.cur.peek() {
if rustc_lexer::is_id_continue(c) {
self.cur.next();
} else {
return &self.input[start..pos];
end = Some(pos);
break;
}
}
&self.input[start..self.input.len()]
let end = end.unwrap_or(self.input.len());
let word = &self.input[start..end];
if word == "_" {
self.err_with_note(
"invalid argument name `_`",
"invalid argument name",
"argument name cannot be a single underscore",
self.to_span_index(start).to(self.to_span_index(end)),
);
}
word
}

/// Optionally parses an integer at the current position. This doesn't deal
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![stable(feature = "rust1", since = "1.0.0")]

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::ascii::{EscapeDefault, escape_default};
pub use core::ascii::{escape_default, EscapeDefault};

/// Extension methods for ASCII-subset only operations.
///
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ use crate::env;
use crate::fmt;
use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst};
use crate::sync::Mutex;
use crate::sys_common::backtrace::{output_filename, lock};
use crate::sys_common::backtrace::{lock, output_filename};
use crate::vec::Vec;
use backtrace_rs as backtrace;
use backtrace::BytesOrWideString;
use backtrace_rs as backtrace;

/// A captured OS thread stack backtrace.
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/benches/hash/map.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg(test)]

use test::Bencher;
use std::collections::HashMap;
use test::Bencher;

#[bench]
fn new_drop(b: &mut Bencher) {
Expand Down
10 changes: 5 additions & 5 deletions src/libstd/collections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,20 +413,20 @@
#[doc(hidden)]
pub use crate::ops::Bound;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{BinaryHeap, BTreeMap, BTreeSet};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{LinkedList, VecDeque};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{binary_heap, btree_map, btree_set};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{linked_list, vec_deque};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{BTreeMap, BTreeSet, BinaryHeap};
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{LinkedList, VecDeque};

#[stable(feature = "rust1", since = "1.0.0")]
pub use self::hash_map::HashMap;
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::hash_set::HashSet;

#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
#[unstable(feature = "try_reserve", reason = "new API", issue = "48043")]
pub use alloc_crate::collections::TryReserveError;

mod hash;
Expand Down
Loading

0 comments on commit d8bdb3f

Please sign in to comment.